<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<title>首页</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />

<!-- easyui -->
<script type="text/javascript" th:src="@{/easyui/jquery.min.js}" ></script>
<script type="text/javascript" th:src="@{/easyui/jquery.easyui.min.js}"></script>
<link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/default/easyui.css}">
<link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/icon.css}">
<link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/color.css}">
	<script type="text/javascript" th:src="@{/easyui/locale/easyui-lang-zh_CN.js}"></script>
</head>
<style>
	*{
		text-align: center;
	}
	textarea{
		text-align: left;
	}
	h2,#editForm{
		padding: 10px 20px;
	}
	#editForm>*{
		margin-top: 10px;
	}
	#editForm input{
		margin-left: 10px;
	}
</style>
<body>
	<h2>实验室预约</h2>
	<form id="editForm" method="post">
		实验室：<select name="lab_id" th:width="100px" id="lab_id"></select><br>
		项目名称：<input name="project_name" class="easyui-validatebox" data-options="required:true"/><br>
		项目类型:<input name="type" class="easyui-validatebox" /><br>
		项目描述:<textarea name="describe" class="easyui-validatebox" rows="3" cols="20"></textarea><br>
		<a id="saveBtn" href="#" class="easyui-linkbutton" >保存</a>
	</form>
	<script type="text/javascript" th:inline="none">
		$(function(){
			$("#lab_id").click(function () {
				$.ajax({
					url:"/lab/findLab",
					type:"POST",
					success:function (data) {
						/*$.each(data){

						}*/
						console.log(data);
					}
				});
			})

			/*保存*/
			$("#saveBtn").click(function () {
				$("#editForm").form("submit",{
					url:"/project/saveProjectApply",     //提交表单
					onSubmit:function(){
						return $("#editForm").form("validate");
					},
					success:function(data){   //回传数据
						data=eval("("+data+")")
						if(data.success){
							$("#win").window("close");
							$("#list").datagrid("reload");
							$.messager.alert("提示","保存成功!","info");
						}else{
							$.messager.alert("提示","保存失败!",data.msg,"error");
						}
					}
				});
			})

		});
	</script>

</body>